package cn.lcvc.xnc.application.service.impl;

import cn.lcvc.xnc.application.common.exception.model.MyWebException;
import cn.lcvc.xnc.application.dao.WasteDisposalSiteMapper;
import cn.lcvc.xnc.application.model.WasteDisposalSite;
import cn.lcvc.xnc.application.model.query.WasteDisposalSiteQuery;
import cn.lcvc.xnc.application.service.WasteDisposalSiteService;
import cn.lcvc.xnc.authority.service.impl.IBaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;

@Service
@Slf4j
public class IWasteDisposalSiteService extends IBaseService<WasteDisposalSite, WasteDisposalSiteQuery> implements WasteDisposalSiteService {

       @Autowired
       WasteDisposalSiteMapper wasteDisposalInfoMapper;


    @Override
    protected void beforeGet(Serializable id) {
    }



    @Override
    protected void beforeSave(WasteDisposalSite wasteDisposalInfo) {

    }

    @Override
    protected void beforeUpdate(WasteDisposalSite wasteDisposalInfo) throws MyWebException {
              if(wasteDisposalInfo.getId()==null){
                  throw new MyWebException("编辑失败：id不能为空");
              }
              if(wasteDisposalInfoMapper.findById(wasteDisposalInfo.getId())==null){
                  throw new MyWebException("编辑失败：找不到指定记录");
              }
    }


    @Override
    protected void beforeDelete(Serializable[] ids) {

    }
}
